home *** CD-ROM | disk | FTP | other *** search
-
- {
- if(true)
- {
- CMouse = §§newclass(CMouse,Sprite);
- }
- }
-
- package Local.Game.World
- {
- import Local.*;
- import Local.Audio.*;
- import Local.Game.*;
- import Local.Game.HUD.*;
- import Local.Game.Level.*;
- import Local.Game.Thing.*;
- import Local.Game.World.Map.*;
- import Local.Game.World.Map.Cell.*;
- import STC9.IO.*;
- import flash.display.*;
- import flash.events.*;
- import flash.filters.*;
- import flash.geom.*;
- import flash.ui.*;
-
- public class CMouse extends Sprite
- {
-
- public static const ACTION_SELECTFRIEND:String = "ACTION_SELECTFRIEND";
-
- public static const ACTION_LAUNCHSTRIKE:String = "ACTION_LAUNCHSTRIKE";
-
- public static var mFilters:Object;
-
- {
- if(true)
- {
- ACTION_LAUNCHSTRIKE = "ACTION_LAUNCHSTRIKE";
- ACTION_SELECTFRIEND = "ACTION_SELECTFRIEND";
- }
- }
-
- public var mLastOverThing:*;
-
- public var mClick:Boolean;
-
- public var mWorld:CWorld;
-
- private var mPointerID:String;
-
- private var _CurrentFilter:Object;
-
- private var _Scope:Boolean;
-
- private var mInitialized:Boolean = false;
-
- private var mPointers:Object;
-
- public var mClickPosition:CPosition;
-
- public var mCurrentPosition:CPosition;
-
- public var mClickThing:*;
-
- private var _LocalPosition:Point;
-
- public var mOverThing:*;
-
- public function CMouse(param1:CWorld)
- {
- mInitialized = false;
- super();
- mWorld = param1;
- addEventListener(Event.ADDED_TO_STAGE,Initialize);
- }
-
- public static function DuplicateObject(param1:Object) : Object
- {
- var _loc2_:Object = null;
- var _loc3_:String = null;
- _loc2_ = new Object();
- for(_loc3_ in param1)
- {
- _loc2_[_loc3_] = param1[_loc3_];
- }
- return _loc2_;
- }
-
- public function ClearFilter() : void
- {
- if(true)
- {
- mCurrentFilter = mFilters["normal"];
- }
- }
-
- public function UpdatePointer() : void
- {
- if(true)
- {
- §§push(mPointerID == "normal");
- if(!(mPointerID == "normal"))
- {
- §§pop();
- if(true)
- {
- addr28:
- if(!_Scope)
- {
- if(true)
- {
- Mouse.show();
- visible = false;
- }
- §§goto(addr49);
- }
- else
- {
- Mouse.hide();
- }
- §§goto(addr49);
- }
- visible = true;
- §§goto(addr49);
- }
- §§goto(addr28);
- }
- addr49:
- }
-
- private function ACTION_SelectFriend() : void
- {
- dispatchEvent(new Event(ACTION_SELECTFRIEND));
- ClearFilter();
- CAudio.PlayGlobalSound(Click);
- }
-
- public function get mLocalPosition() : Point
- {
- return _LocalPosition;
- }
-
- public function Process() : void
- {
- if(CKeyboard.IsReleased("ESCAPE"))
- {
- Cancel();
- }
- §§push(mLastOverThing);
- if(true)
- {
- if(§§pop())
- {
- if(true)
- {
- §§pop();
- §§push(mLastOverThing == mOverThing);
- }
- §§push(!§§pop());
- }
- }
- if(§§pop())
- {
- mLastOverThing.mMouseOver = false;
- }
- Process_Filter();
- mClick = false;
- mLastOverThing = mOverThing;
- mOverThing = null;
- }
-
- public function get mHUD() : CHUD
- {
- return mWorld.mGame.mHUD;
- }
-
- public function AddPointer(param1:String, param2:Class) : void
- {
- mPointers[param1] = new param2();
- }
-
- private function Process_Filter() : void
- {
- var _loc1_:* = null;
- var _loc2_:String = null;
- §§push(!!mOverThing ? (mOverThing.mGroupID == CThingContainer.GROUPID_ENEMY ? (!!mOverThing.mTargetAirbourne ? "enemyair" : "enemyground") : "friend") : "position");
- if(true)
- {
- _loc1_ = §§pop();
- _loc2_ = (mClick ? "click" : "over") + _loc1_;
- mClickThing = mClick && mOverThing ? mOverThing : null;
- §§push(_loc2_);
- }
- if(§§pop() == "overfriend")
- {
- mOverThing.mMouseOver = true;
- }
- if(mCurrentFilter[_loc2_])
- {
- var _loc3_:* = typeof mCurrentFilter[_loc2_];
- if(true)
- {
- if("string" !== _loc3_)
- {
- if("boolean" === _loc3_)
- {
- §§goto(addr122);
- }
- else
- {
- §§push("function" === _loc3_ ? 2 : 3);
- }
- }
- §§goto(addr131);
- }
- §§goto(addr127);
- }
- else
- {
- SetPointer("normal");
- }
- addr131:
- switch(true ? 0 : 1)
- {
- case 0:
- SetPointer(mCurrentFilter[_loc2_]);
- break;
- case 1:
- SetPointer(_loc2_);
- break;
- case 2:
- mCurrentFilter[_loc2_]();
- }
- }
-
- public function set mLocalPosition(param1:Point) : void
- {
- if(true)
- {
- x = param1.x;
- y = param1.y;
- }
- }
-
- public function Cancel() : void
- {
- ClearFilter();
- mHUD.DeselectAll();
- mClick = false;
- if(mLastOverThing)
- {
- mLastOverThing.mMouseOver = false;
- }
- }
-
- public function Initialize(param1:Event = null) : void
- {
- if(true)
- {
- removeEventListener(Event.ADDED_TO_STAGE,Initialize);
- if(true)
- {
- mPointers = new Object();
- if(true)
- {
- mCurrentPosition = new CPosition();
- if(true)
- {
- mLocalPosition = new CPosition();
- if(true)
- {
- mClickPosition = new CPosition();
- if(true)
- {
- AddPointer("overposition",Pointer_Target);
- }
- AddPointer("overfriend",Pointer_OverThing);
- }
- AddPointer("overenemy",Pointer_OverTarget);
- }
- AddPointer("invalid",Pointer_InvalidTarget);
- }
- mInitialized = true;
- }
- SetupFilters();
- }
- }
-
- private function SetPointer(param1:String) : void
- {
- while(numChildren)
- {
- removeChildAt(0);
- }
- if(param1 != "normal")
- {
- addChild(mPointers[param1]);
- }
- mPointerID = param1;
- UpdatePointer();
- }
-
- public function set mScope(param1:Boolean) : void
- {
- _Scope = param1;
- UpdatePointer();
- }
-
- public function set mCurrentFilter(param1:Object) : void
- {
- _CurrentFilter = DuplicateObject(param1);
- UpdatePointer();
- }
-
- private function ACTION_LaunchStrike() : void
- {
- dispatchEvent(new Event(ACTION_LAUNCHSTRIKE));
- Cancel();
- CAudio.PlayGlobalSound(Click);
- }
-
- public function SetupFilters() : void
- {
- var _loc1_:Object = null;
- mFilters = new Object();
- _loc1_ = mFilters["normal"] = new Object();
- if(true)
- {
- _loc1_["overposition"] = "normal";
- if(true)
- {
- _loc1_["overfriend"] = "overfriend";
- _loc1_["clickfriend"] = ACTION_SelectFriend;
- }
- _loc1_["state"] = "none";
- }
- _loc1_ = mFilters["unit"] = DuplicateObject(mFilters["default"]);
- _loc1_ = mFilters["strike"] = DuplicateObject(mFilters["default"]);
- if(true)
- {
- _loc1_["overposition"] = "overposition";
- if(true)
- {
- _loc1_["clickposition"] = ACTION_LaunchStrike;
- if(true)
- {
- _loc1_["overenemyair"] = "overenemy";
- _loc1_["overenemyground"] = "overenemy";
- }
- _loc1_["clickenemyair"] = ACTION_LaunchStrike;
- }
- _loc1_["clickenemyground"] = ACTION_LaunchStrike;
- }
- _loc1_ = mFilters["strikeLG"] = DuplicateObject(mFilters["strike"]);
- if(true)
- {
- _loc1_["overenemyair"] = "invalid";
- _loc1_["clickenemyair"] = "invalid";
- }
- _loc1_ = mFilters["strikeLA"] = DuplicateObject(mFilters["strike"]);
- _loc1_["overenemyground"] = "invalid";
- _loc1_["clickenemyground"] = "invalid";
- _loc1_ = mFilters["strikeL"] = DuplicateObject(mFilters["strike"]);
- if(true)
- {
- _loc1_["overenemyair"] = "invalid";
- if(true)
- {
- _loc1_["clickenemyair"] = "invalid";
- _loc1_["overenemyground"] = "invalid";
- }
- _loc1_["clickenemyground"] = "invalid";
- }
- _loc1_ = mFilters["strikeAG"] = DuplicateObject(mFilters["strike"]);
- _loc1_["overposition"] = "invalid";
- _loc1_["clickposition"] = "invalid";
- _loc1_ = mFilters["strikeA"] = DuplicateObject(mFilters["strike"]);
- _loc1_["overposition"] = "invalid";
- _loc1_["clickposition"] = "invalid";
- _loc1_["overenemyground"] = "invalid";
- _loc1_["clickenemyground"] = "invalid";
- _loc1_ = mFilters["strikeG"] = DuplicateObject(mFilters["strike"]);
- _loc1_["overposition"] = "invalid";
- _loc1_["clickposition"] = "invalid";
- _loc1_["overenemyair"] = "invalid";
- _loc1_["clickenemyair"] = "invalid";
- ClearFilter();
- }
-
- public function get mCurrentFilter() : Object
- {
- return _CurrentFilter;
- }
-
- public function get mScope() : Boolean
- {
- return _Scope;
- }
-
- public function Dispose() : void
- {
- if(parent)
- {
- parent.removeChild(this);
- }
- Mouse.show();
- }
- }
- }
-